<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE unspecified PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="js/jquery.min.js" type="text/javascript"></script>
<link href="css/zhu/bootstrap.min.css" rel="stylesheet">
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<link href="css/zhu/Administrators.css" rel="stylesheet">
<script type="text/javascript">
	$(function() {
		$("#tijiaouser").click(function() {
			//获得:姓名,用户名,密 码,电 话,身份证,银行卡,余 额,驾驶证,驾驶证领取时间
			var username = $("input[name=username]").val();//姓名
			var usernames = $("input[name=usernames]").val();//用户名
			var userpass = $("input[name=userpass]").val();//密 码
			var usertelep = $("input[name=usertelep]").val();//电话
			var userid = $("input[name=userid]").val();//身份证
			var userbank = $("input[name=userbank]").val();//银行卡
			var userbalance = $("input[name=userbalance]").val();//余额
			var userlicense = $("input[name=userlicense]").val();//驾驶证
			var userdrilicolti = $("input[name=userdrilicolti]").val();//驾驶证领取时间
			if (username == null || username == "") {
				//姓名
				$(".username_tips > span").html("姓名不能为空！");
				$("input[name=username]").focus();
				return;
			} else if (usernames == null || usernames == "") {
				//用户名
				$(".usernames_tips > span").html("用户名不能为空！");
				$("input[name=usernames]").focus();
				return;
			} else if (userpass == null || userpass == "") {
				//密 码
				$(".userpass_tips > span").html("密码不能为空！");
				$("input[name=userpass]").focus();
				return;
			} else if (usertelep == null || usertelep == "") {
				//电话
				$(".usertelep_tips > span").html("电话不能为空！");
				$("input[name=usertelep]").focus();
				return;
			} else if (userid == null || userid == "") {
				//身份证
				$(".userid_tips > span").html("身份证不能为空！");
				$("input[name=userid]").focus();
				return;
			} else if (userbank == null || userbank == "") {
				//银行卡
				$(".userbank_tips > span").html("银行卡不能为空！");
				$("input[name=userbank]").focus();
				return;
			} else if (userbalance == null || userbalance == "") {
				//余额
				$(".userbalance_tips > span").html("余额不能为空！");
				$("input[name=userbalance]").focus();
				return;
			} else if (userlicense == null || userlicense == "") {
				//驾驶证
				$(".userlicense_tips > span").html("驾驶证不能为空！");
				$("input[name=userlicense]").focus();
				return;
			} else if (userdrilicolti == null || userdrilicolti == "") {
				//驾驶证领取时间
				$(".userdrilicolti_tips > span").html("驾驶证领取时间不能为空！");
				$("input[name=userdrilicolti]").focus();
				return;
			} else {
				$(".user_form").submit();
			}
		})
		$("[tijiaorechargemoney]").click(function() {
			var tr = $(this).parent().prev().find("tr");
			var Recharge_money = tr.eq(1).find("input").val();
			var Recharge_id = tr.eq(2).find("input").val();
			$.post("recharge", {
				Recharge_money : Recharge_money,
				Recharge_id : Recharge_id
			}, function(data, success) {
				alert(data);
				location.href = "/fuhe/zhu";
			})
		})
		$("[recorduser]").on("show.bs.modal", function() {
			var id = $(this).attr("recorduser");
			$.getJSON("addrechargerecord", {
				ids : id
			}, function(e) {
				$("[tb]").empty();
				for (var i = 0; i < e.length; i++) {
					//创建tr
					var $tr = $("<tr></tr>");
					var $td = $("<td></td>");
					$tr.append($td.clone().text(e[i].name));
					$tr.append($td.clone().text(e[i].phone));
					$tr.append($td.clone().text(e[i].username));
					$tr.append($td.clone().text(e[i].password));
					$tr.append($td.clone().text(e[i].reason));
					$tr.append($td.clone().text(e[i].money));
					$tr.append($td.clone().text(e[i].time));
					$tr.append($td.clone().text(e[i].condition1));
					$tr.appendTo($("[tb]"));
				}
			})
		});
		$("[modifyuser]")
				.click(
						function() {
							var tr = $(this).parent().prev().find("tr");
							var modifuseryname = tr.eq(0).find("input").val();
							var modifuseryphone = tr.eq(1).find("input").val();
							var modifuseryusername = tr.eq(2).find("input")
									.val();
							var modifuserypassword = tr.eq(3).find("input")
									.val();
							var modifuseryidcard = tr.eq(4).find("input").val();
							var modifuserydriving_license = tr.eq(5).find(
									"input").val();
							var modifuserydriving_license_time = tr.eq(6).find(
									"input").val();
							var modifuserybankcar = tr.eq(7).find("input")
									.val();
							var modifuseryid = tr.eq(8).find("input").val();
							if (modifuseryname == "" || modifuseryname == null) {
								$(".modifyuser_1 > span").html("姓名不能为空！");
								return;
							} else if (modifuseryphone == ""
									|| modifuseryphone == null) {
								$(".modifyuser_2 > span").html("电话不能为空！");
								return;
							} else if (modifuseryusername == ""
									|| modifuseryusername == null) {
								$(".modifyuser_3 > span").html("用户名不能为空！");
								return;
							} else if (modifuserypassword == ""
									|| modifuserypassword == null) {
								$(".modifyuser_4 > span").html("密码不能为空！");
								return;
							} else if (modifuseryidcard == ""
									|| modifuseryidcard == null) {
								$(".modifyuser_5 > span").html("身份证不能为空！");
								return;
							} else if (modifuserydriving_license == ""
									|| modifuserydriving_license == null) {
								$(".modifyuser_6 > span").html("驾驶证号不能为空！");
								return;
							} else if (modifuserydriving_license_time == ""
									|| modifuserydriving_license_time == null) {
								$(".modifyuser_7> span").html("驾驶证领取时间不能为空！");
								return;
							} else if (modifuserybankcar == ""
									|| modifuserybankcar == null) {
								$(".modifyuser_8 > span").html("银行卡号不能为空！");
								return;
							}
							$
									.post(
											"modifyuser",
											{
												modifuseryname : modifuseryname,
												modifuseryphone : modifuseryphone,
												modifuseryusername : modifuseryusername,
												modifuserypassword : modifuserypassword,
												modifuseryidcard : modifuseryidcard,
												modifuserydriving_license : modifuserydriving_license,
												modifuserydriving_license_time : modifuserydriving_license_time,
												modifuserybankcar : modifuserybankcar,
												modifuseryid : modifuseryid
											}, function(data, success) {
												alert(data);
												location.href = "/fuhe/zhu";
											})
						});
	})
</script>
</head>
<body>
	<c:set var="isDoing" value="0" />
	<c:forEach items="${powerList}" var="power" varStatus="status">

		<c:if test="${power.name=='管理员管理' && isDoing==0}" var="u">
			<!--  设置跳出 条件 -->
			<c:set var="isDoing" value="1" />
			<div class="right">
				<div class="right-a">
					<span>会员管理 </span>
				</div>
				<div class="right-b">
					<div class="right-b-a">
						<ul>
							<li></li>
							<li></li>
							<li>
								<button type="button" class="btn btn-primary"
									data-toggle="modal" data-target="#myModal2"
									style="float: right; margin-top: 12px; width: 52px; text-indent: -1px;">+添加</button>
								<div class="modal fade" id="myModal2" tabindex="-1"
									role="dialog" aria-labelledby="myModalLabel">
									<div class="modal-dialog">
										<div class="modal-content">
											<div class="modal-header">
												<button data-dismiss="modal" class="close" type="button">
													<span aria-hidden="true" style="font-size: 22px">×</span><span
														class="sr-only">Close</span>
												</button>
												<h4 class="modal-title">添加</h4>
											</div>
											<div class="modal-body" style="height: 430px;">
												<form action="/fuhe/adduser" class="user_form"
													style="margin-left: 100px" method="post">
													<input type="hidden" value="" />
													<table border="0" cellspacing="0" cellpadding="0">
														<tbody>
															<tr>
																<td>姓&nbsp名&nbsp：</td>
																<td style="display: block; margin-left: -165px;"><input
																	type="text" name="username">
																	<div class="username_tips">
																		<span style="color: red"></span>
																	</div></td>
															</tr>
															<tr style="display: block; margin-top: 20px;">
																<td>用户名：</td>
																<td><input type="text" name="usernames">
																	<div class="usernames_tips">
																		<span style="color: red"></span>
																	</div></td>
															</tr>
															<tr style="display: block; margin-top: 20px;">
																<td>密&nbsp码&nbsp：</td>
																<td><input type="text" name="userpass">
																	<div class="userpass_tips">
																		<span style="color: red"></span>
																	</div></td>
															</tr>
															<tr style="display: block; margin-top: 20px;">
																<td>电&nbsp话&nbsp：&nbsp</td>
																<td><input type="text" name="usertelep">
																	<div class="usertelep_tips">
																		<span style="color: red"></span>
																	</div></td>
															</tr>
															<tr style="display: block; margin-top: 20px;">
																<td>身份证：</td>
																<td><input type="text" name="userid">
																	<div class="userid_tips">
																		<span style="color: red"></span>
																	</div></td>
															</tr>
															<tr style="display: block; margin-top: 20px;">
																<td>银行卡：</td>
																<td><input type="text" name="userbank">
																	<div class="userbank_tips">
																		<span style="color: red"></span>
																	</div></td>
															</tr>
															<tr style="display: block; margin-top: 20px;">
																<td>余&nbsp额&nbsp：&nbsp</td>
																<td><input type="text" name="userbalance">
																	<div class="userbalance_tips">
																		<span style="color: red"></span>
																	</div></td>
															</tr>
															<tr style="display: block; margin-top: 20px;">
																<td>驾驶证：</td>
																<td><input type="text" name="userlicense">
																	<div class="userlicense_tips">
																		<span style="color: red"></span>
																	</div></td>
															</tr>
															<tr style="display: block; margin-top: 20px;">
																<td style="display: block; margin-left: -46px;">驾驶证领取时间：</td>
																<td
																	style="display: block; margin-left: 56px; margin-top: -20"><input
																	type="text" name="userdrilicolti">
																	<div class="userdrilicolti_tips">
																		<span style="color: red"></span>
																	</div></td>
															</tr>
														</tbody>
													</table>
												</form>
											</div>
											<div class="modal-footer">
												<button data-dismiss="modal" class="btn btn-default"
													type="button">关闭</button>
												<button class="btn btn-primary" id="tijiaouser"
													type="button">提交</button>
											</div>
										</div>
									</div>
								</div>
							</li>
						</ul>
					</div>
					<div>
						<table width="100%" border="0" cellspacing="0" cellpadding="0"
							class="tablelist table table-striped table-bordered table-hover  table-condensed">
							<thead>
								<th width="8%">名称</th>
								<th width="8%">用户名</th>
								<th width="10%">角色</th>
								<th width="9%">电话</th>
								<th width="10%">身份证</th>
								<th width="9%">驾驶证号</th>
								<th width="6%">余额</th>
								<th width="8%">银行卡</th>
								<th width="32%">
									<center>操作</center>
								</th>
							</thead>
							<tbody id="userud_cx">
								<c:forEach items="${userud}" var="ua">
									<tr>
										<td>${ua.name}</td>
										<td>${ua.username}</td>
										<td>普通用户</td>
										<td>${ua.phone}</td>
										<td>${ua.idcard}</td>
										<td>${ua.driving_license}</td>
										<td>${ua.account}</td>
										<td>${ua.bankcar}</td>
										<td>
											<button type="button" class="btn btn-primary"
												data-toggle="modal" data-target="#modifyuser${ua.id}">修改</button>
											<div class="modal fade" id="modifyuser${ua.id}" tabindex="-1"
												role="dialog" aria-labelledby="myModalLabel">
												<div class="modal-dialog">
													<div class="modal-content">
														<div class="modal-header">
															<button data-dismiss="modal" class="close" type="button">
																<span aria-hidden="true">×</span><span class="sr-only">Close</span>
															</button>
															<h4 class="modal-title">修改</h4>
														</div>
														<div class="modal-body">
															<form method="post">
																<input type="hidden" value="" />
																<table border="0" cellspacing="0" cellpadding="0">
																	<tbody>
																		<tr>
																			<td>姓名:</td>
																			<td><input type="text" value="${ua.name }">
																				<div class="modifyuser_1">
																					<span style="color: red"></span>
																				</div></td>
																		</tr>
																		<tr>
																			<td>电话:</td>
																			<td><input type="text" value="${ua.phone }">
																				<div class="modifyuser_2">
																					<span style="color: red"></span>
																				</div></td>
																		</tr>
																		<tr>
																			<td>用户名:</td>
																			<td><input type="text" value="${ua.username }">
																				<div class="modifyuser_3">
																					<span style="color: red"></span>
																				</div></td>
																		</tr>
																		<tr>
																			<td>密码:</td>
																			<td><input type="text" value="${ua.password }">
																				<div class="modifyuser_4">
																					<span style="color: red"></span>
																				</div></td>
																		</tr>
																		<tr>
																			<td>身份证:</td>
																			<td><input type="text" value="${ua.idcard }">
																				<div class="modifyuser_5">
																					<span style="color: red"></span>
																				</div></td>
																		</tr>
																		<tr>
																			<td>驾驶证号：</td>
																			<td><input type="text"
																				value="${ua.driving_license }">
																				<div class="modifyuser_6">
																					<span style="color: red"></span>
																				</div></td>
																		</tr>
																		<tr>
																			<td>驾驶证领取时间:</td>
																			<td><input type="text"
																				value="${ua.driving_license_time }">
																				<div class="modifyuser_7">
																					<span style="color: red"></span>
																				</div></td>
																		</tr>
																		<tr>
																			<td>银行卡号:</td>
																			<td><input type="text" value="${ua.bankcar }">
																				<div class="modifyuser_8">
																					<span style="color: red"></span>
																				</div></td>
																		</tr>
																		<tr style="display: none">
																			<td>id:</td>
																			<td><input type="text" value="${ua.id }">
																				<div class="modifyuser_9">
																					<span style="color: red"></span>
																				</div></td>
																		</tr>
																	</tbody>
																</table>
															</form>
														</div>
														<div class="modal-footer">
															<button data-dismiss="modal" class="btn btn-default"
																type="button">关闭</button>
															<button class="btn btn-primary" type="button"
																modifyuser="${ua.id}">提交</button>
														</div>
													</div>
													<!-- /.modal-content -->
												</div>
												<!-- /.modal-dialog -->
											</div>
											<button type="button" class="btn btn-success"
												data-toggle="modal" data-target="#rechargeuser${ua.id}">充值</button>
											<div class="modal fade" id="rechargeuser${ua.id}"
												tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
												<div class="modal-dialog">
													<div class="modal-content">
														<div class="modal-header">
															<button data-dismiss="modal" class="close" type="button">
																<span aria-hidden="true">×</span><span class="sr-only">Close</span>
															</button>
															<h4 class="modal-title">充值</h4>
														</div>
														<div class="modal-body">
															<form action="" method="post">
																<input type="hidden" value="" />
																<table border="0" cellspacing="0" cellpadding="0">
																	<tbody>
																		<tr>
																			<td>身份证:</td>
																			<td><input name="recharge_idcard"
																				value="${ua.idcard}" readonly="readonly">
																				<div class="recharge1_tips">
																					<span style="color: red"></span>
																				</div></td>
																		</tr>
																		<tr>
																			<td>充值金额:</td>
																			<td><input name="recharge_money">
																				<div class="recharge2_tips">
																					<span style="color: red"></span>
																				</div></td>
																		</tr>
																		<tr style="display: none">
																			<td>id:</td>
																			<td><input name="recharge_id" value="${ua.id}"></td>
																		</tr>
																	</tbody>
																</table>
															</form>
														</div>
														<div class="modal-footer">
															<button data-dismiss="modal" class="btn btn-default"
																type="button">关闭</button>
															<button class="btn btn-primary" type="button"
																tijiaorechargemoney="${ua.id}">提交</button>
														</div>
													</div>
													<!-- /.modal-content -->
												</div>
												<!-- /.modal-dialog -->
											</div>
											<button type="button" class="btn btn-info"
												data-toggle="modal" data-target="#recorduser${ua.id}">充值记录</button>
											<div class="modal fade" id="recorduser${ua.id}" tabindex="-1"
												role="dialog" aria-labelledby="myModalLabel"
												recorduser="${ua.id}">
												<div class="modal-dialog">
													<div class="modal-content">
														<div class="modal-header">
															<button data-dismiss="modal" class="close" type="button">
																<span aria-hidden="true">×</span><span class="sr-only">Close</span>
															</button>
															<h4 class="modal-title">充值记录</h4>
														</div>
														<div class="modal-body">
															<table style="margin-left: 0px">
																<thead>
																	<th width="8%">名称</th>
																	<th width="9%">电话</th>
																	<th width="8%">用户名</th>
																	<th width="8%">密码</th>
																	<th width="10%">充值方式</th>
																	<th width="8%">充值金额</th>
																	<th width="20%">充值时间</th>
																	<th width="37%">备注</th>
																</thead>
																<tbody tb="${ua.id}">

																</tbody>
															</table>
														</div>
														<div class="modal-footer">
															<button data-dismiss="modal" class="btn btn-default"
																type="button">确认</button>
														</div>
													</div>
												</div>
											</div>
										</td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
					</div>
				</div>
			</div>


		</c:if>
		<c:if test="${fn:length(powerList) == status.count && isDoing==0 }">
			<c:if test="${!u }">
				<jsp:include page="403.jsp"></jsp:include>
			</c:if>
		</c:if>
	</c:forEach>
</body>
</html>